﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Uniforax.Core.Common;
using Uniforax.Core.GameObjects;
using Uniforax.Core.Skills;

namespace Uniforax.Core.GameActions.SkillEffect
{
    public class SkillEffect1v1Action : SkillEffectAction
    {
        public PosId FromPosId { get; set; }
        public string FromObjectId { get; set; }
        public PosId ToPosId { get; set; }
        public string ToObjectId { get; set; }

        public BaseSkill Skill { get; set; }

        public SkillEffect1v1Action(BaseGameObject from, BaseGameObject to, BaseSkill skill)
        {
            FromObjectId = from.ObjectId;
            FromPosId = from.PosId;
            ToObjectId = to.ObjectId;
            ToPosId = to.PosId;

            Skill = skill;
        }

        public override void Execute(ActionContext context)
        {
            var world = context.GameWorld;
            var fromGrid = world.GetGrid(FromPosId);
            var fromObject = fromGrid.GetPlacedObject(FromObjectId);

            var toGrid = world.GetGrid(ToPosId);
            var toObject = toGrid.GetPlacedObject(ToObjectId);

            var skillContext = new SkillContext();
            Skill.Effect(context, skillContext);
        }

        public override void Undo(ActionContext context)
        {
            base.Undo(context);
        }
    }
}
